﻿<Window x:Class="WPFToolboxForSiemensPLCs.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"        
        xmlns:dockwin="clr-namespace:WPFToolboxForSiemensPLCs.DockableWindows"      
        mc:Ignorable="d" 
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
        xmlns:ad="clr-namespace:AvalonDock;assembly=AvalonDock" 
        xmlns:avalonEdit="clr-namespace:ICSharpCode.AvalonEdit;assembly=ICSharpCode.AvalonEdit"
        xmlns:local="clr-namespace:JFKCommonLibrary.WPF.Converters;assembly=JFKCommonLibrary"
        Title="WPFToolBox for Siemens PLCs" Height="800" Width="1000" Icon="/WPFToolboxForSiemensPLCs;component/Images/1.png" Closing="Window_Closing">
<Window.Resources>
        <ControlTemplate x:Name="TemplateEditor" x:Key="TemplateEditor" TargetType="avalonEdit:TextEditor">
            <ScrollViewer Background="{TemplateBinding Control.Background}" BorderBrush="{TemplateBinding Control.BorderBrush}" BorderThickness="{TemplateBinding Control.BorderThickness}" CanContentScroll="True" Content="{Binding Path=TextArea, RelativeSource={RelativeSource TemplatedParent}}" Focusable="False" HorizontalContentAlignment="Left" HorizontalScrollBarVisibility="Hidden" Name="PART_ScrollViewer" Padding="{TemplateBinding Control.Padding}" VerticalContentAlignment="Top" VerticalScrollBarVisibility="Hidden" />
            <ControlTemplate.Triggers>
                <Trigger Property="avalonEdit:TextEditor.WordWrap" Value="True">
                    <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" TargetName="PART_ScrollViewer" Value="Disabled" />
                </Trigger>
            </ControlTemplate.Triggers>
        </ControlTemplate>
        <local:BoolToBrushConverter x:Key="ConnectedConverter" FalseValue="Red" TrueValue="Green" />

    </Window.Resources>
    
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="20"/>
            <RowDefinition/>
            <RowDefinition Height="32"/>
        </Grid.RowDefinitions>

        <Menu>
            <MenuItem Header="Main">
                <MenuItem Header="Open-Project" Click="MenuItem_Click"></MenuItem>
                <MenuItem Header="Open-Project (show deleted)" Click="MenuItem_Click_1"></MenuItem>  
                <Separator></Separator>
                <MenuItem Header="Print" Name="mnuPrint" Click="mnuPrint_Click"></MenuItem>
            </MenuItem>
            <MenuItem Header="Windows">
                <!--<MenuItem Header="ProjectTree" IsChecked="True"></MenuItem>-->              
            </MenuItem>
            <MenuItem Header="Connection">
                <MenuItem Header="Config" Name="mnuConfig" Click="mnuConfig_Click"></MenuItem>
                <Separator></Separator>
                <MenuItem Header="Connect" Name="mnuConnect" Click="mnuConnect_Click"></MenuItem>
                <MenuItem Header="Disconnect" Name="mnuDisconnect" Click="mnuDisconnect_Click"></MenuItem>
                <Separator></Separator>
                <MenuItem Header="Show Online Blocks" Name="mnuOnlineBlocks" Click="mnuOnlineBlocks_Click"></MenuItem>
                <Separator></Separator>
                <MenuItem Header="View Block" Name="mnuViewBlock" Click="mnuViewBlock_Click"></MenuItem>
                <MenuItem Header="Unview Block" Name="mnuUnViewBlock" Click="mnuUnViewBlock_Click"></MenuItem>
                <Separator></Separator>
                <MenuItem Header="SZL Window" Name="mnuSZLWindow" Click="mnuSZLWindow_Click"></MenuItem>
            </MenuItem>
            <MenuItem Header="DiffWindow" Click="MenuItem_Click_3"></MenuItem>
            <MenuItem Header="DB2WinCC" Click="MenuItem_Click_4"></MenuItem>
        </Menu>
    
    <ad:DockingManager x:Name="DockManager" IsAnimationEnabled="True" Grid.Row="1" Margin="0,0,0,0"
                     ActiveContent="{Binding ElementName=Content1}" >
        <ad:DockingManager.LayoutTransform>
            <ScaleTransform
                    ScaleX="{Binding Value, ElementName=zoomSlider}"
                    ScaleY="{Binding Value, ElementName=zoomSlider}"/>
        </ad:DockingManager.LayoutTransform>
            <ad:ResizingPanel Orientation="Horizontal" >
                <ad:ResizingPanel Orientation="Vertical"  ad:ResizingPanel.ResizeWidth="0.25*">
                    <ad:DockablePane SelectedIndex="1" ad:ResizingPanel.ResizeHeight="1.9*" SelectionChanged="DockablePane_SelectionChanged">
                        <dockwin:DockableContentProjectList x:Name="ProjectTree" Title="ProjectTree" IsCloseable="False" />                      
                    </ad:DockablePane>                  
                </ad:ResizingPanel>
                <ad:DocumentPane x:Name="DocumentHost">
                </ad:DocumentPane>
            </ad:ResizingPanel>
    </ad:DockingManager>
        <StatusBar Grid.Row="2">
            <StatusBarItem HorizontalContentAlignment="Left">
                <StackPanel Orientation="Horizontal" >
                    <TextBlock Text="A" VerticalAlignment="Center"/>
                    <Slider x:Name="zoomSlider" VerticalAlignment="Center" Value="1" IsSnapToTickEnabled="True" TickFrequency="0.2" TickPlacement="Both" Minimum="0.5" Maximum="3" SmallChange="0.5" LargeChange="0.5" Width="100"/>
                    <TextBlock Text="A" FontSize="20" VerticalAlignment="Center"/>
                </StackPanel>
            </StatusBarItem>
            <StatusBarItem HorizontalContentAlignment="Right">
                <DockPanel HorizontalAlignment="Stretch">
                    
                <TextBlock Name="lblStatus"></TextBlock>
                <TextBlock Text="  "></TextBlock>
                <TextBlock Text="{Binding Connection.Configuration}"></TextBlock>
                <TextBlock Text="  "></TextBlock>
                    <Rectangle DockPanel.Dock="Left" Fill="{Binding Connection.Connected, Converter={StaticResource ConnectedConverter}}" Width="20" Height="20"></Rectangle>
                    <TextBlock Text="  "></TextBlock>
                    <TextBlock Name="lblVersion">1.0</TextBlock>
                </DockPanel>
            </StatusBarItem>
            
            
            
        </StatusBar>
</Grid>
</Window>
